/*
 * Copyright 2008 Zoundry LLC, Inc.  All Rights Reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 */
package org.zoundry.gaedt.ui.sdk;

import java.io.File;
import java.io.IOException;
import org.eclipse.core.resources.IProject;
import org.python.pydev.plugin.nature.IPythonPathContributor;
import org.zoundry.gaedt.core.util.ZGaeUtil;
import org.zoundry.gaedt.sdk.IZGaeSDKConstants;
import org.zoundry.gaedt.sdk.ZGaeSDK;


/**
 * Contributes the path to the Google App Engine SDK to pydev.
 */
public class ZGaeSdkPathContributor implements IPythonPathContributor
{
    /**
     * @see org.python.pydev.plugin.nature.IPythonPathContributor#getAdditionalPythonPath(org.eclipse.core.resources.IProject)
     */
    public String getAdditionalPythonPath(IProject aProject)
    {
        try
        {
            File sdkPath = new File(ZGaeSDK.getInstance().getLocation(), IZGaeSDKConstants.SDK_FOLDER_NAME);
            return sdkPath.getCanonicalPath();
        }
        catch (IOException e)
        {
            ZGaeUtil.logError(e);
            return null;
        }
    }
}
